package com.example.teesystem.common.websocket.model;

import com.example.teesystem.entity.Issue;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Data
public class GroupInfo {
    /**
     * 分组 id
     */
    private String id;
    
    /**
     * 更新时间
     */
    private LocalDateTime updateTime;
    
    /**
     * 玩家 a
     */
    private UserInfo userA;
    
    /**
     * 玩家 b
     */
    private UserInfo userB;
    
    /**
     * 题目列表
     */
    private List<Issue> issues;
    
    /**
     * 该分组正在回答的题目
     */
    private Integer curIssue;
    
    /**
     * key 为第几道题， value 为回答者的 id
     */
    private Map<Integer, Integer> answerConditions = new ConcurrentHashMap<>();
    
    public GroupInfo() {
        this.updateTime = LocalDateTime.now();
    }
    
    public GroupInfo(String id, UserInfo userA, UserInfo userB, List<Issue> issues) {
        this.id = id;
        this.userA = userA;
        this.userB = userB;
        this.issues = issues;
        this.curIssue = 0;
        this.updateTime = LocalDateTime.now();
    }
}
